#pragma once
#include <mutex>

class Mutex
{
public:
    Mutex()
    {
        pthread_mutex_init(&_lock, nullptr);
    }

    void Lock()
    {
        pthread_mutex_lock(&_lock);
    }

    void Unlock()
    {
        pthread_mutex_unlock(&_lock);
    }

    ~Mutex()
    {
        pthread_mutex_destroy(&_lock);
    }
private:
    pthread_mutex_t _lock;
};

class GuardMutex
{
public:
    GuardMutex()
    {
        _lock.Lock();
    }

    ~GuardMutex()
    {
        _lock.Unlock();
    }
private:
    Mutex _lock;
};

